/*
 * Copyright (c) 2002-2004, xRhino, Inc.
 *
 * This library is free software; you can redistribute and/or modify
 * it under the terms of the dual license distributed with this source
 * package (a combined Trolltech QPL/GPL-compatible license)
 *
 * Under this dual license scheme, a separate license is available for use of 
 * this code with a proprietary (closed) system. For more information on the 
 * license, please see the LICENSE file distributed with this source package.
 */
#include "SugNode.h"

char* SugNode::getNodeName()
{
   return mNodeName;
}
char* SugNode::setNodeName(char* newNodeName)
{
   mNodeName = newNodeName;
   return newNodeName;
}
char* SugNode::getNodeValue()
{
   return mNodeValue;
}
char* SugNode::setNodeValue(char* newNodeValue)
{
   mNodeValue = newNodeValue;
   return newNodeValue;
}
unsigned short SugNode::getNodeType()
{
   return mNodeType;
}
unsigned short SugNode::setNodeType(unsigned short newNodeType)
{
   mNodeType = newNodeType;
   return newNodeType;
}
SugNode* SugNode::getParentNode()
{
   return mParentNode;
}
SugNode* SugNode::setParentNode(SugNode* newParentNode)
{
   mParentNode = newParentNode;
   return newParentNode;
}
vector<SugNode>* SugNode::getChildNodes()
{
   return &mChildNodes;
}
SugNode* SugNode::getFirstChild()
{
   return mFirstChild;
}
SugNode* SugNode::setFirstChild(SugNode* newFirstChild)
{
   mFirstChild = newFirstChild;
   return newFirstChild;
}
SugNode* SugNode::getLastChild()
{
   return mLastChild; 
}
SugNode* SugNode::setLastChild(SugNode* newLastChild)
{
   mLastChild = newLastChild;
   return newLastChild;
}
SugNode* SugNode::getPreviousSibling()
{
   return mPreviousSibling;
}
SugNode* SugNode::setPreviousSibling(SugNode* newPreviousSibling)
{
   mPreviousSibling = newPreviousSibling;
   return newPreviousSibling;
}
SugNode* SugNode::getNextSibling()
{
   return mNextSibling;
}
SugNode* SugNode::setNextSibling(SugNode* newNextSibling)
{
   mNextSibling = newNextSibling;
   return newNextSibling;
}

SugNode* SugNode::insertBefore(SugNode* newChild, SugNode* refChild)
{
   //return in pointer if successful, or NULL if fail
   //if prevNode of refChild is NULL, then just set it... right?
   //if it isn't NULL then set the nextNode of the prevNode to be newChild and 
   //   set the nextNode of newChild to be refNode, and the prevNode of refChild to be newChild.

   //READ ME: Fill this in when you figure out how to do the nodes
   return NULL;
}

SugNode* SugNode::replaceChild(SugNode* newChild, SugNode* oldChild)
{
   //Find child?
   //take the prevNode, children, parent, and nextNode and put them into newChild... and make sure you
   //set the parent's child, prevNode's nextNode, nextNode's prevNode, and children's parent
   //READ ME: Fill this in when you figure out how to do the nodes
   return NULL;
}

SugNode* SugNode::removeChild(SugNode* oldChild)
{
   //Set the prevNode's nextNode to nextNode and nextNode's prevNode to prevNode, delete all children
   //READ ME: Fill this in when you figure out how to do the nodes
   return NULL;
}

SugNode* SugNode::appendChild(SugNode* newChild)
{
   //Add child to children list, set parent of child to self.
   //READ ME: Fill this in when you figure out how to do the nodes
   mChildNodes.push_back(*newChild);
   return NULL;
}

bool SugNode::hasChildNodes()
{
   if (mChildNodes.size() > 0)
   {
      return true;
   }
   else
   {
      return false;
   }
}

bool SugNode::hasAttributes()
{
   //READ ME: Fill this in when you figure out how to do the attributes
   return false;
}

SugNode::SugNode()
{
   mParentNode = NULL;
   mFirstChild = NULL;
   mLastChild = NULL;
   mPreviousSibling = NULL;
   mNextSibling = NULL;
}

SugNode::~SugNode()
{
}

